﻿using System;
using System.Drawing;
using System.Windows.Forms;
using Interfaces;
using Presenters;

namespace Views
{
    public partial class clientAddView : UserControl, IClientAddView
    {
        ClientAddPresenter presenter = null;

        public clientAddView()
        {
            InitializeComponent();
            presenter = new ClientAddPresenter(this);
        }

        #region Member's

        DateTime IClientAddView.dateInsert
        {
            get
            {
                return dateInsert.Value;
            }
            set
            {
                dateInsert.Value = value;
            }
        }

        string IClientAddView.descriptionClient
        {
            get
            {
                return richTextBox1.Text;
            }
            set
            {
                richTextBox1.Text = value as String;
            }
        }

        string IClientAddView.email
        {
            get
            {
                return email.Text;
            }
            set
            {
                email.Text = value as String;
            }
        }

        int IClientAddView.idClient
        {
            get
            {
                return 0;
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        int IClientAddView.idGroup
        {
            get
            {
                return 1;
            }
            set
            {
                checkBox1.Checked = true;
            }
        }

        string IClientAddView.inventedName
        {
            get
            {
                return inventedName.Text;
            }
            set
            {
                inventedName.Text = value as String;
            }
        }

        bool IClientAddView.isProtected
        {
            get
            {
                return isProtected.Checked;
            }
            set
            {
                isProtected.Checked = value;
            }
        }

        string IClientAddView.nameClient
        {
            get
            {
                return nameClient.Text;
            }
            set
            {
                nameClient.Text = value as String;
            }
        }

        string IClientAddView.nameCorporation
        {
            get
            {
                return nameCorporation.Text;
            }
            set
            {
                nameCorporation.Text = value as String;
            }
        }

        string IClientAddView.phoneNumber
        {
            get
            {
                return phoneNumber.Text;
            }
            set
            {
                phoneNumber.Text = value as String;
            }
        }

        string IClientAddView.surnameClient
        {
            get
            {
                return surnameClient.Text;
            }
            set
            {
                surnameClient.Text = value as String;
            }
        }

        #endregion

        UserControl IClientAddView.ReturnView()
        {
            return this;
        }

        void IClientAddView.ShowError()
        {
            presenter.ShowFormView(new ErrorParentView());
        }

        void IClientAddView.ShowSuccess()
        {
            presenter.SuccessDisplay(new SuccessView());
        }

        private void button1_Click(object sender, EventArgs e)
        {
            presenter.Save();
        }
    }
}
